HOW TO COMPILE PBHUNSPELL.DLL WITH VISUAL STUDIO
================================================

Author: Davros
Date:   2018-07-01

SOFTWARE USED
=============
* Windows 10
* Visual Studio Community 2017
* DLL Export viewer (freeware)
* Dumpbin (part of Visual Studio)
* Hunspell master version of 2018-01-01
* Hyphen (libHnj) master version of 2017-11-27
* MyThes master version of 2017-05-27

GOAL
====
This document describes the procedure to compile pbhunspell.dll (development & release) with Visual Studio.

DOWNLOAD
========
Download directory '.\pbh' and put it for example in 'c:\'.

CHECK MSVC PROJECT PROPERTIES
=============================
Open Solution 'c:\pbh\pbhunspell.sln'.

A. In Project Properties - Property Pages of project pbhunspell use following configuration when compiling for Debug version:

Configuration bar
* Configuration: Debug
* Platform: Win32

Configuration Properties - General
* (Target Platform: Windows)
* Windows SDK Version: 7.0
* Target Extension: .dll
* Platform Toolset: Visual Studio 2017 - Windows XP (v141_xp)
* Configuration Type: Dynamic Library (.dll)
* Use of MFC: Use Standard Windows Libraries
* Character Set: Use Unicode Character Set

Configuration Properties - C/C++ - All Options
* Calling Convention: __stdcall (/Gz)
* Conformance mode: No
* Disable Specific Warnings: 4706
* Enable Minimal Rebuild: No (/Gm-)
* Optimization: Disabled (/Od)
* Precompiled Header: Not Using Precompiled Headers
* Preprocessor Definitions: WIN32;_DEBUG;PBHUNSPELL_EXPORTS;_WINDOWS;_USRDLL;HUNSPELL_STATIC;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)
* SDL checks: No (/sdl-)
* Warning Level: Level4 (/W4)

Configuration Properties - Linker - All Options
* Enable Incremental Linking: No (/INCREMENTAL:NO)
* Generate Debug Info: Generate Debug Information optimized for sharing and publishing (/DEBUG:FULL)
* Image Has Safe Exception Handlers: Yes (/SAFESEH)
* Module Definition File: pbhunspell.def
* SubSystem: Windows (/SUBSYSTEM:WINDOWS)

B. In Project Properties - Property Pages of project pbhunspell use following configuration when compiling for Release version:

Configuration bar
* Configuration: Release
* Platform: Win32

Configuration Properties - General
* (Target Platform: Windows)
* Windows SDK Version: 8.1
* Target Extension: .dll
* Platform Toolset: Visual Studio 2017 (v141)
* Configuration Type: Dynamic Library (.dll)
* Use of MFC: Use Standard Windows Libraries
* Character Set: Use Unicode Character Set
* Whole Program Optimization: Use Link Time Code Generation

Configuration Properties - C/C++ - All Options
* Calling Convention: __stdcall (/Gz)
* Conformance mode: No
* Disable Specific Warnings: 4706
* Enable Function-Level Linking: Yes (/Gy)
* Enable Intrinsic Functions: Yes (/Oi)
* Enable Minimal Rebuild: No (/Gm-)
* Optimization: Maximize Speed (/O2)
* Precompiled Header: Not Using Precompiled Headers
* Preprocessor Definitions: WIN32;NDEBUG;PBHUNSPELL_EXPORTS;_WINDOWS;_USRDLL;HUNSPELL_STATIC;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)
* SDL checks: Yes (/sdl)
* Warning Level: Level3 (/W3)
* Whole Program Optimization: Yes(/GL)

Configuration Properties - Linker - All Options
* Enable COMDAT Folding: Yes (/OPT:ICF)
* Enable Incremental Linking: No (/INCREMENTAL:NO)
* Generate Debug Info: Generate Debug Information (/DEBUG)
* Image Has Safe Exception Handlers: Yes (/SAFESEH)
* Module Definition File: pbhunspell.def
* References: Yes (/OPT:REF)
* SubSystem: Windows (/SUBSYSTEM:WINDOWS)

BUILD
=====
Rebuild project pbhunspell. Following warnings can be ignored:
* C4267 and C4244 data conversion errors.
* 1>affentry.obj : warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/SAFESEH' specification

For Debug version, build result is 'c:\pbh\Debug\pbhunspell.dll'. For Release version, build result is 'c:\pbh\Release\pbhunspell.dll'.

Check the exported functions by:
* opening the dll with 'DLL Export viewer', or
* executing DUMPBIN (in Windows Search box type 'Developer Command Prompt for VS 2017'. Then in command prompt:
  - for Debug version,  type 'dumpbin /exports "c:\pbh\Debug\pbhunspell.dll"';
  - for Release version,  type 'dumpbin /exports "c:\pbh\Release\pbhunspell.dll"'.

For Debug version, copy 'c:\pbh\Debug\pbhunspell.dll' to PowerBuilder application directory. For Release version, copy 'c:\pbh\Release\pbhunspell.dll' to PowerBuilder application directory. NOTE: When PowerBuilder is running, Windows copy may tell that the file was copied whereas in reality it was not because PowerBuilder was locking it. So first close PowerBuilder, then copy the dll and run 'dumpbin /exports' on the copy to be 100% sure.
